---
swagger: '2.0'
info:
  version: 1.0.0
  title: GeoServer Template
  description: Manage templates used to configure output (for example GetFeatureInfo reponse). Templates can be registered for the entire server or workspace. You can also configure a template for use with a store, featureType or coverage.
  contact:
    name: GeoServer
    email: 'geoserver-users@sourceforge.net'
    url: 'http://geoserver.org/comm/'
host: localhost:8080
basePath: /geoserver/rest

paths:
  /templates:
    get:
      operationId: templatesGet
      tags:
       - "Templates"
      summary: List of templates for the server
      description: Displays a list of templates registered for use on the server.
      produces:
        - text/html
        - application/xml
        - application/json
      responses:
        200:
          description: OK
          schema:
            $ref: "#/definitions/Templates"
    post:
      operationId: templatesPost
      tags:
       - "Templates"
      description: Invalid. PUT to `/{template}` to edit a template.
      responses:
        405:
          description: Method Not Allowed
    put:
      operationId: templatesPut
      tags:
       - "Templates"
      description: Invalid. PUT to `/{template}` to edit a template.
      responses:
        405:
          description: Method Not Allowed
    delete:
      operationId: templatesDelete
      tags:
       - "Templates"
      description: Invalid. Delete from `/{template}` to remove a template.
      responses:
        405:
          description: Method Not Allowed

  /workspaces/{workspace}/templates:
    parameters:
      - $ref: "#/parameters/Workspace"  
    get:
      operationId: templatesWorkspaceGet
      tags:
       - "Templates"
      summary: List of templates for workspace
      description: Displays a list of templates registered for use in a workspace (example for GetFeatureInfo WMS operation).
      produces:
        - text/html
        - application/xml
        - application/json
      responses:
        200:
          description: OK
          schema:
            $ref: "#/definitions/Templates"
    post:
      operationId: templatesWorkspacePost
      tags:
       - "Templates"
      description: Invalid. PUT to `/{template}` to edit a template.
      responses:
        405:
          description: Method Not Allowed
    put:
      operationId: templatesWorkspacePut
      tags:
       - "Templates"
      description: Invalid. PUT to `/{template}` to edit a template.
      responses:
        405:
          description: Method Not Allowed
    delete:
      operationId: templatesWorkspaceDelete
      tags:
       - "Templates"
      description: Invalid. Delete from `/{template}` to remove a template.
      responses:
        405:
          description: Method Not Allowed

  /workspaces/{workspace}/datastores/{store}/templates:
    parameters:
      - $ref: "#/parameters/Workspace"
      - $ref: "#/parameters/Store"      
    get:
      operationId: templatesDataStoreGet
      tags:
       - "Templates"
      summary: List of templates for a data store
      description: Displays a list of templates registered for use by all layers generated by a data store (example for GetFeatureInfo WMS operation).
      produces:
        - text/html
        - application/xml
        - application/json
      responses:
        200:
          description: OK
          schema:
            $ref: "#/definitions/Templates"
    post:
      operationId: templatesDataStorePost
      tags:
       - "Templates"
      description: Invalid. PUT to `/{template}` to edit a template.
      responses:
        405:
          description: Method Not Allowed
    put:
      operationId: templatesDataStorePut
      tags:
       - "Templates"
      description: Invalid. PUT to `/{template}` to edit a template.
      responses:
        405:
          description: Method Not Allowed
    delete:
      operationId: templatesDataStoreDelete
      tags:
       - "Templates"
      description: Invalid. Delete from `/{template}` to remove a template.
      responses:
        405:
          description: Method Not Allowed

  /workspaces/{workspace}/datastores/{store}/featuretypes/{type}/templates:
    parameters:
      - $ref: "#/parameters/Workspace"  
      - $ref: "#/parameters/Store"  
      - name: type
        in: path
        required: true
        type: string
        description: The feature type name      
    get:
      operationId: templatesDataStoreFTGet
      tags:
       - "Templates"
      summary: List of templates for a feature type.
      description: Displays a list of templates registered for use by feature type (example for GetFeatureInfo WMS operation).
      produces:
        - text/html
        - application/xml
        - application/json
      responses:
        200:
          description: OK
          schema:
            $ref: "#/definitions/Templates"
    post:
      operationId: templatesDataStoreFTPost
      tags:
       - "Templates"
      description: Invalid. PUT to `/{template}` to edit a template.
      responses:
        405:
          description: Method Not Allowed
    put:
      operationId: templatesDataStoreFTPut
      tags:
       - "Templates"
      description: Invalid. PUT to `/{template}` to edit a template.
      responses:
        405:
          description: Method Not Allowed
    delete:
      operationId: templatesDataStoreFTDelete
      tags:
       - "Templates"
      description: Invalid. Delete from `/{template}` to remove a template.
      responses:
        405:
          description: Method Not Allowed

  /workspaces/{workspace}/coveragestore/{store}/templates:
    parameters:
      - $ref: "#/parameters/Workspace"
      - $ref: "#/parameters/Store"
    get:
      operationId: templatesDataStoreCSGet
      tags:
       - "Templates"
      summary: List of templates for a coverage store
      description: Displays a list of templates registered for use by all layers generated by a coverage store (example for GetFeatureInfo WMS operation).
      produces:
        - text/html
        - application/xml
        - application/json
      responses:
        200:
          description: OK
          schema:
            $ref: "#/definitions/Templates"
    post:
      operationId: templatesDataStoreCSPost
      tags:
       - "Templates"
      description: Invalid. PUT to `/{template}` to edit a template.
      responses:
        405:
          description: Method Not Allowed
    put:
      operationId: templatesDataStoreCSPut
      tags:
       - "Templates"
      description: Invalid. PUT to `/{template}` to edit a template.
      responses:
        405:
          description: Method Not Allowed
    delete:
      operationId: templatesDataStoreCSDelete
      tags:
       - "Templates"
      description: Invalid. Delete from `/{template}` to remove a template.
      responses:
        405:
          description: Method Not Allowed

  /workspaces/{workspace}/coveragestore/{store}/coverages/{coverage}/templates:
    parameters:
      - $ref: "#/parameters/Workspace"
      - $ref: "#/parameters/Store"
      - name: coverage
        in: path
        required: true
        type: string
        description: The coverage name
    get:
      operationId: templatesCoverageGet
      tags:
       - "Templates"
      summary: List of templates for a coverage
      description: Displays a list of templates registered for use by a coverage (example for GetFeatureInfo WMS operation).
      produces:
        - text/html
        - application/xml
        - application/json
      responses:
        200:
          description: OK
          schema:
            $ref: "#/definitions/Templates"
    post:
      operationId: templatesCoveragePost
      tags:
       - "Templates"
      description: Invalid. PUT to `/{template}` to edit a template.
      responses:
        405:
          description: Method Not Allowed
    put:
      operationId: templatesCoveragePut
      tags:
       - "Templates"
      description: Invalid. PUT to `/{template}` to edit a template.
      responses:
        405:
          description: Method Not Allowed
    delete:
      operationId: templatesCoverageDelete
      tags:
       - "Templates"
      description: Invalid. Delete from `/{template}` to remove a template.
      responses:
        405:
          description: Method Not Allowed

  /templates/{template}.ftl:
    parameters:
      - $ref: "#/parameters/Template"
    get:
      operationId: templateGet
      tags:
       - "Templates"
      summary: Return a template
      description: Displays a single template registered for use on the server.
      produces:
        - text/plain
      responses:
        200:
          description: OK
          schema:
            $ref: "#/definitions/Templates"
    post:
      operationId: templatePost
      tags:
       - "Templates"
      description: Invalid. Use PUT to insert a template.
      responses:
        405:
          description: Method Not Allowed
    put:
      operationId: templatePut
      tags:
       - "Templates"
      summary: Insert or update a template
      description: Inserts or updates a single template registered for use on the server. Overwrites any existing template with the same name and location.
      consumes:
        - text/plain
      parameters:
        - $ref: "#/parameters/TemplateBody"
      responses:
        201:
          description: Created
    delete:
      operationId: templateDelete
      tags:
       - "Templates"
      summary: Delete a template.
      description: Deletes a single template registered for use on the server.
      responses:
        200:
          description: OK
        404: 
          description: Template not found

  /workspaces/{workspace}/templates/{template}.ftl:
    parameters:
      - $ref: "#/parameters/Workspace"
      - $ref: "#/parameters/Template" 
    get:
      operationId: templateWorkspaceGet
      tags:
       - "Templates"
      summary: Return a template for workspace
      description: Displays a single template registered for use in a workspace (example for GetFeatureInfo WMS operation).
      produces:
        - text/plain
      responses:
        200:
          description: OK
          schema:
            $ref: "#/definitions/Templates"
    post:
      operationId: templateWorkspacePost
      tags:
       - "Templates"
      description: Invalid. Use PUT to insert a template.
      responses:
        405:
          description: Method Not Allowed
    put:
      operationId: templateWorkspacePut
      tags:
       - "Templates"
      summary: Insert or update a template
      description: Inserts or updates a single template registered for use in a workspace (example for GetFeatureInfo WMS operation). Overwrites any existing template with the same name and location.
      consumes:
        - text/plain
      parameters:
        - $ref: "#/parameters/TemplateBody"
      responses:
        201:
          description: Created
    delete:
      operationId: templateWorkspaceDelete
      tags:
       - "Templates"
      summary: Delete a template.
      description: Deletes a single template registered for use in a workspace.
      responses:
        200:
          description: OK
        404: 
          description: Template not found

  /workspaces/{workspace}/datastores/{store}/templates/{template}.ftl:
    parameters:
      - $ref: "#/parameters/Workspace"
      - $ref: "#/parameters/Store"
      - $ref: "#/parameters/Template"    
    get:
      operationId: templateDataStoreGet
      tags:
       - "Templates"
      summary: Return a template for a data store
      description: Displays a single template registered for use by all layers generated by a data store (example for GetFeatureInfo WMS operation).
      produces:
        - text/plain
      responses:
        200:
          description: OK
          schema:
            $ref: "#/definitions/Templates"
    post:
      operationId: templateDataStorePost
      tags:
       - "Templates"
      description: Invalid. Use PUT to insert a template.
      responses:
        405:
          description: Method Not Allowed
    put:
      operationId: templateDataStorePut
      tags:
       - "Templates"
      summary: Insert or update a template
      description: Inserts or updates a single template registered for use by all layers generated by a data store (example for GetFeatureInfo WMS operation). Overwrites any existing template with the same name and location.
      consumes:
        - text/plain
      parameters:
        - $ref: "#/parameters/TemplateBody"
      responses:
        201:
          description: Created
    delete:
      operationId: templateDataStoreDelete
      tags:
       - "Templates"
      summary: Delete a template.
      description: Deletes a single template registered for use by all layers generated by a data store.
      responses:
        200:
          description: OK
        404: 
          description: Template not found

  /workspaces/{workspace}/datastores/{store}/featuretypes/{type}/templates/{template}.ftl:
    parameters:
      - $ref: "#/parameters/Workspace"  
      - $ref: "#/parameters/Store"
      - name: type
        in: path
        required: true
        type: string
        description: The feature type name
      - $ref: "#/parameters/Template"    
    get:
      operationId: templateDataStoreFTGet
      tags:
       - "Templates"
      summary: Return a template for a feature type.
      description: Displays a single template registered for use by a feature type (example for GetFeatureInfo WMS operation).
      produces:
        - text/plain
      responses:
        200:
          description: OK
          schema:
            $ref: "#/definitions/Templates"
    post:
      operationId: templateDataStoreFTPost*
      tags:
       - "Templates"
      description: Invalid. Use PUT to insert a template.
      responses:
        405:
          description: Method Not Allowed
    put:
      operationId: templateDataStoreFTPut
      tags:
       - "Templates"
      summary: Insert or update a template
      description: Inserts or updates a single template registered for use by a feature type (example for GetFeatureInfo WMS operation). Overwrites any existing template with the same name and location.
      consumes:
        - text/plain
      parameters:
        - $ref: "#/parameters/TemplateBody"
      responses:
        201:
          description: Created
    delete:
      operationId: templateDataStoreFTDelete
      tags:
       - "Templates"
      summary: Delete a template.
      description: Deletes a single template registered for use by a feature type.
      responses:
        200:
          description: OK
        404: 
          description: Template not found

  /workspaces/{workspace}/coveragestore/{store}/templates/{template}.ftl:
    parameters:
      - $ref: "#/parameters/Workspace"
      - $ref: "#/parameters/Store"
      - $ref: "#/parameters/Template"
    get:
      operationId: templateDataStoreCSGet
      tags:
       - "Templates"
      summary: Return a template for a coverage store
      description: Displays a single template registered for use by all layers generated by a coverage store (example for GetFeatureInfo WMS operation).
      produces:
        - text/plain
      responses:
        200:
          description: OK
          schema:
            $ref: "#/definitions/Templates"
    post:
      operationId: templateDataStoreCSPost
      tags:
       - "Templates"
      description: Invalid. Use PUT to insert a template.
      responses:
        405:
          description: Method Not Allowed
    put:
      operationId: templateDataStoreCSPut
      tags:
       - "Templates"
      summary: Insert or update a template
      description: Inserts or updates a single template registered for use by all layers generated by a coverage store (example for GetFeatureInfo WMS operation). Overwrites any existing template with the same name and location.
      consumes:
        - text/plain
      parameters:
        - $ref: "#/parameters/TemplateBody"
      responses:
        201:
          description: Created
    delete:
      operationId: templateDataStoreCSDelete
      tags:
       - "Templates"
      summary: Delete a template.
      description: Deletes a single template registered for use by all layers generated by a coverage store.
      responses:
        200:
          description: OK
        404: 
          description: Template not found

  /workspaces/{workspace}/coveragestore/{store}/coverages/{coverage}/templates/{template}.ftl:
    parameters:
      - $ref: "#/parameters/Workspace"
      - $ref: "#/parameters/Store"
      - name: coverage
        in: path
        required: true
        type: string
        description: The coverage name
      - $ref: "#/parameters/Template"
    get:
      operationId: templateCoverageGet
      tags:
       - "Templates"
      summary: Return a template for a coverage
      description: Displays a single template registered for use by a coverage (example for GetFeatureInfo WMS operation).
      produces:
        - text/plain
      responses:
        200:
          description: OK
          schema:
            $ref: "#/definitions/Templates"
    post:
      operationId: templateCoveragePost
      tags:
       - "Templates"
      description: Invalid. Use PUT to insert a template.
      responses:
        405:
          description: Method Not Allowed
    put:
      operationId: templateCoveragePut
      tags:
       - "Templates"
      summary: Insert or update a template
      description: Inserts or updates a single template registered for use by a coverage (example for GetFeatureInfo WMS operation). Overwrites any existing template with the same name and location.
      consumes:
        - text/plain
      parameters:
        - $ref: "#/parameters/TemplateBody"
      responses:
        201:
          description: Created
    delete:
      operationId: templateCoverageDelete
      tags:
       - "Templates"
      summary: Delete a template.
      description: Deletes a single template registered for use by a coverage.
      responses:
        200:
          description: OK
        404: 
          description: Template not found

parameters:
  Workspace:
    name: workspace
    in: path
    required: true
    type: string
    description: The workspace name
  Store:
    name: store
    in: path
    required: true
    type: string
    description: The store name 
  Template:
    name: template
    in: path
    required: true
    type: string
    description: The template name
  TemplateBody:
    name: template
    in: body
    required: true
    description: The template content to upload
    schema:
      type: string

definitions:
  Templates:
    title: templates
    type: object
    properties:
      layerGroups:
        type: object
        
  TemplateReference:
    title: layers
    type: object
    properties:
      name:
        type: string
        description: Name of template
      link:
        type: string
        description: URL to template definition
